<template>
  <div class="sourceSelect">
    <el-select v-model="val" @change="change" clearable :disabled="disabled">
      <el-option
        v-for="(item, index) in sourceList"
        :key="index"
        :label="item.purchaseChannel"
        :value="item.purchaseChannel"
      ></el-option>
    </el-select>
    <i class="el-icon-s-tools" @click="setSource"></i>
  </div>
</template>

<script>
export default {
  components: {},
  props: {
    sourceList: Array,
    value: String,
    disabled:{
      type:Boolean,
      default:false
    }
  },
  data() {
    return {
      val: ''
    };
  },
  watch: {
    value(str, s2) {
      if (str) this.val = str
    },
  },
  computed: {},
  created() {},
  mounted() {
  },
  methods: {
    change(e) {
      this.$emit("change", e);
    },
    setSource() {
      this.$emit('setSource')
    }
  },
  destroyed() {},
};
</script>

<style lang="less" scoped>
.sourceSelect {
  display: flex;
  /deep/ .el-select {
    flex: 1;
  }
  > i {
    color: #2ea7e0;
    font-size: 18px;
    margin-left: 5px;
    align-self: center;
    cursor: pointer;
  }
}
</style>
